/**
 * 功能说明:
 * 功能作者:
 * 创建日期:
 * 版权归属:每特教育|蚂蚁课堂所有 www.itmayiedu.com
 */
package com.ehcache.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;

import com.ehcache.entity.UserEntity;
@CacheConfig(cacheNames = "userCache")
//@CacheConfig 开启ehcache
//cacheNames 开启缓存的名称
//@Cacheable  加了该注解的方法表示可以缓存
//@CacheConfig 表示创建缓存配置，Key为userCache
public interface UserMapper {
	@Select(" SELECT  * FROM user where userName=#{userName} and userAge=#{userAge}")
	public UserEntity login(UserEntity userEntity);

	@Insert("insert into user(userName,userAge) values(#{userName},#{userAge})")
	public int insertUser(UserEntity userEntity);
	
	@Select(" SELECT  * FROM user where id=#{id} ")
	@Cacheable
	public UserEntity selectById(long id);
}
